import java.util.Scanner;

public class Test {


    public static void main1(String[] args) {
        Scanner sc = new Scanner(System.in);
        String str = sc.nextLine();
        int[] arr = new int[26];
        for(int i = 0;i<str.length();i++){
            char ch = str.charAt(i);
            arr[ch-'a']++;
        }
        StringBuilder sb = new StringBuilder();
        for(int i = 0 ; i<str.length();i++){
            char ch=str.charAt(i);
            for (int j = 0; j < arr.length; j++) {

            }
        }
        String str1 = sb.toString();
        System.out.print(str1);
    }

    public static void main(String[] args) {
        int[] a ={4,5,6,0,0,0};
        int[] b = {1,2,3};
        merge2(a,3,b,3);
        System.out.println(a);
    }

    public static void main2(String[] args) {
        Scanner sc = new Scanner(System.in);
        while (sc.hasNextLine()){
            String str = sc.nextLine();
            int[] arr = new int[26];
            int[] arr1 = new int[26];
            StringBuilder sb = new StringBuilder();
            for(int i = 0;i<str.length();i++){
                char ch = str.charAt(i);
                if(arr[ch-'a']==0){
                    sb.append(ch);
                    arr[ch-'a']++;
                }
                if(ch>'A'&&ch<'Z'&&arr1[ch-'A']==0){
                    sb.append(ch);
                    arr1[ch-'A']++;
                }


            }


            String str1 = sb.toString();
            System.out.print(str1);
        }

    }

    //两个有序数组原地排序
    public void merge(int A[], int m, int B[], int n) {
        int i = m-1;
        int j = n-1;
        int k = m+n-1;
        while(i>=0&&j>=0){
            if(A[i]>=B[j]){
                A[k--]=A[i--];
            }else{
                A[k--]=B[j--];
            }
        }
        while(j>=0){
            A[k--]=B[j--];
        }
        while(i>=0){
            A[k--]=A[i--];
        }
    }
    //两个有序数组归并排序
    public static void merge2(int A[], int m, int B[], int n) {
        int[] k = new int[n+m];
        int j = 0;
        int l = 0;
        for (int i = 0; i <k.length ; i++) {
            if(l<n&&j<m&&A[j]<=B[l]){
                k[i]=A[j];
                j++;
            }else if(l<n&&j<m&&A[j]>B[l]) {
                k[i]=B[l];
                l++;
            }else if(l>=n){
                k[i]=A[j];
                j++;
            }else if(j>=m){
                k[i]=B[l];
                l++;
            }
        }
        for (int i = 0; i <k.length ; i++) {
            A[i]=k[i];
        }
    }
    public static void merge1(int A[], int m, int B[], int n) {
        int p=n;

            for (int j = 0; j <n ; j++) {
                A[p]=B[j];
                p++;
            }

        for (int i = 0; i <A.length-1 ; i++) {
            boolean flg = false;
            for (int j = 0; j <A.length-1-i ; j++) {
                if(A[j]>A[j+1]){
                    int tmp = A[j];
                    A[j] = A[j+1];
                    A[j+1]=tmp;
                    flg=true;
                }
            }
            if(flg==false){
                break;
            }
        }
    }

}
